﻿using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;

namespace GC_FFW.BusinessEntities.Forecast.Xml
{
	[XmlRoot("conditions")]
	public class Conditions
	{
		#region Properties

		[XmlElement("condition")]
		public List<Condition> Items { get; set; }

		#endregion

		#region Methods

		public Condition GetCondition(int order)
		{
			return Items != null && Items.Any()
				? Items.FirstOrDefault(i => i.Order == order)
				: null;
		}

		#endregion
	}
}
